const baseurl='https://api.map.baidu.com/weather/v1/?data_type=all&ak=23f8xYBckLSqFalgQLwFli1Q7odoznGz&district_id='
Page({
  data:{
    city:"",
    temperature:'',
    direct:''
  },
  input(e){
    console.log(e)
    this.setData({
      city:e.detail.value
    })
  },
  search(){
    let city = this.data.city
    let url = `${baseurl}${city}`
    console.log(url)
    let that = this
    wx.request({
      url,
      success(e){
        console.log(e)
        let {temp,wind_dir} = e.data.result.now
        that.setData({
          temperature:temp,
          direct:wind_dir
        })
      }
    })
  }
})